package org.Caitlyn.common.util;

import java.util.Map;

/**
 * 
 * @类功能说明： 分页参数封装类
 * @类修改者：
 * @修改日期：
 * @修改说明：
 * @作者：Aaron
 * @创建时间：2016年5月18日 下午4:39:16
 */
public class PageRequest {
	/**
	 * 查询页数
	 */
	private Integer page;
	
	/**
	 * 每页显示记录数
	 */
	private Integer rows;
	/**
	 * 总页数
	 */
	private Integer totalPage;
	
	/**
	 * 总记录数
	 */
	private Integer totalRecord;
	
	/**
	 * 数据库起始记录索引
	 */
	private Long startIndex;
	
	/**
	 * 数据库结束记录索引
	 */
	private Long endIndex;
	
	/**
	 * 排序字段
	 */
	private String sort;
	
	/**
	 * 排序顺序
	 */
	private String order;
	
	/**
	 * 参数
	 * */
	private Map<String, Object> queryMap;
	
	
	public Long getStartIndex() {
		startIndex = ((page - 1) * rows) * 1L; 
		return startIndex;
	}

	public void setStartIndex(Long startIndex) {
		this.startIndex = startIndex;
	}

	public Long getEndIndex() {
		endIndex = (page * rows) * 1L;
		return endIndex;
	}

	public void setEndIndex(Long endIndex) {
		this.endIndex = endIndex;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}
	
	public Integer getRows() {
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
	}

	public Integer getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}

	public Integer getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(Integer totalRecord) {
		this.totalRecord = totalRecord;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public Map<String, Object> getQueryMap() {
		return queryMap;
	}

	public void setQueryMap(Map<String, Object> queryMap) {
		this.queryMap = queryMap;
	}

	public String toString() {
		return "PageRequest [page=" + page + ", totalPage=" + totalPage
				+ ", totalRecord=" + totalRecord + ", sort=" + sort
				+ ", order=" + order + ", queryMap=" + queryMap + "]";
	}
	
}
